package com.qyhl.webtv.commonlib.utils.view.video.player;

import android.content.Context;
import android.util.AttributeSet;

import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

;

/**
 * Created by qyhl on 2018/3/12.
 */

public class MoreRouterVideoPlayer extends StandardGSYVideoPlayer {

    private StateListener listener;

    public MoreRouterVideoPlayer(Context context, Boolean fullFlag) {
        super(context, fullFlag);
    }

    public MoreRouterVideoPlayer(Context context) {
        super(context);
    }

    public MoreRouterVideoPlayer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setListener(StateListener listener) {
        this.listener = listener;
    }

    @Override
    protected void touchSurfaceUp() {
        super.touchSurfaceUp();
        try {
            listener.state(true);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    protected void changeUiToPreparingShow() {
        super.changeUiToPreparingShow();
        try {
            listener.state(true);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    protected void changeUiToPauseShow() {
        super.changeUiToPauseShow();
        try {
            listener.state(true);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    protected void hideAllWidget() {
        super.hideAllWidget();
        try {
            listener.state(false);
        }catch (Exception e){
             e.printStackTrace();
        }
    }

    public interface StateListener {
        void state(boolean isShow);
    }


}
